package com.ds.lens.data.common.document;

import com.ds.lens.data.common.constant.MonitorStateEnum;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author WeiShaoying
 * @date 2019/11/11 下午4:59
 */
@Setter
@Getter
public class DataPoint implements Serializable {
    private static final long serialVersionUID = -8708904722161073034L;
    private Double value;
    private Long timeStamp;
    private MonitorStateEnum state;

    /**
     * 动态告警预测值
     */
    private Double forecast;
    /**
     * 动态告警 预测的上边界
     */
    private Double alertThresholdUpper;
    /**
     * 动态告警 预测的下边界
     */
    private Double alertThresholdLower;

    public DataPoint() {
    }

    public DataPoint(Double value, Long timeStamp, MonitorStateEnum state, Double alertThresholdUpper, Double alertThresholdLower, Double forecast) {
        this.value = value;
        this.timeStamp = timeStamp;
        this.state = state;
        this.alertThresholdUpper = alertThresholdUpper;
        this.alertThresholdLower = alertThresholdLower;
        this.forecast = forecast;
    }

    @Override
    public boolean equals(Object other) {
        if (other instanceof DataPoint) {
            return this.timeStamp.equals(((DataPoint) other).timeStamp);
        } else {
            return false;
        }
    }

    public void setState(MonitorStateEnum state) {
        this.state = state;
    }
}

